package cn.fresh.xuanyuan.module.infra.controller.app.rule;

import cn.fresh.xuanyuan.framework.common.pojo.CommonResult;
import cn.fresh.xuanyuan.module.infra.service.rule.ITextRuleService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 文本校验
 */
@RestController
@RequestMapping(value = "/infra/rule")
@Tag(name = "用户 微信端 - 文本合规验证")
@Slf4j
public class TextRuleController {

    @Resource
    private ITextRuleService textRuleService;

    @GetMapping(value = "/checkText")
    public CommonResult<Boolean> checkText(@RequestParam(name = "content") String content, @RequestParam(name = "appId") Long appId, @RequestParam(name = "openId") String openId) {
        boolean check = textRuleService.checkText(content, appId, openId);
        return CommonResult.success(check);
    }
}
